package com.labofjet.blogv3.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import com.labofjet.blogv3.dao.IUserDao;
import com.labofjet.blogv3.model.User;

@Service
public class UserService {
	@Autowired
	IUserDao userDao;
	
	@Cacheable(value = "user", key = "#username")
	public User findOne(String username, String password){
		return userDao.findByUserNameAndPassword(username, password);
	}
	
	@Cacheable(value = "user", key = "#id")
	public User findOne(long id){
		return userDao.findOne(id);
	}
}
